<?php

namespace App\Http\Controllers\home\lxShop;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\Product;
class IndexController extends Controller
{
    function index(){
        $products=Product::all();
        return view('home.lxshop.index')->with('products',$products);
    }
    
    function more(Request $request){
        $page = $request->page;
        $skip = ($page-1) * 5;
        $products = Product::orderBy('sort_order','is_onsale')->skip($skip)->take(5)->get();
        return $products;
    }
}
